      FUNCTION DARCOS(X)
      IMPLICIT REAL*8(A-H,O-Z)
      IF(X) 20,10,20
   10 DARCOS=1.5707963267948966D0
      RETURN
   20 IF(DABS(X).LT.1.D0) GO TO 30
      DARCOS=0.D0
      GO TO 40
   30 DARCOS=DATAN(DSQRT(1.D0-X**2)/X)
   40 IF(X.GT.0.D0) RETURN
      DARCOS=DARCOS + 3.141592653589793D0
      RETURN
      END
